import request from '../../../../../public/js/common/api/api.js';

const PigsltrUrl = Utils.CurDomain.PigsltrUrl;
const FeedBackUrl = Utils.CurDomain.FeedBackUrl;
const _ajaxOptions = {
    contentType: 'application/json',
    dataType: 'json',
    async: true,
    dataFilter(data, type) {
        return data;
    }
};
export default class DailyApi {
    /**
       * 获取日报
       * @param {*} data 
       * @returns 
       */
    static getDailyList(id) {
        return request.get(`${PigsltrUrl}/dailysnapshots/${id}`);
    }
    /**
       * 获取Gid
       * @param {*} data 
       * @returns 
       */
    static queryGidInfo(data) {
        return request.get(`${Utils.CurDomain.WeiXinUrl}/wxauths/code?code=${data.code}&state=${data.state}`, { ajaxOptions: _ajaxOptions });
    }

    /**
       * 获取TOCKEN
       * @param {*} data 
       * @returns 
       */
    static queryTokenInfo(gid) {
        return request.get(`${Utils.CurDomain.SysAuthUrl}/account/wechat/${gid}`, { ajaxOptions: _ajaxOptions });
    }

    static queryUserName(sid) {
        return request.get(`${Utils.CurDomain.WeiXinUrl}/wxauths/cur?sid=${sid}`);
    }

    // 获取查阅用户
    static queryReadingUser(id) {
        return request.get(`${FeedBackUrl}/yyreads/${id}/us`);
    }

    // 创建实体查阅
    static addReadingUser(id, data) {
        return request.post(`${FeedBackUrl}/yyreads/${id}`, data);
    }
}